package IteratorAndComposite.composite.entry;

import IteratorAndComposite.composite.interfaces.MenuComponent;

/**
 * @Author: pengzx
 * @Description:
 * @Date: 17:40 2017/9/22
 * @Modified by: 1.0
 */
public class MenuItem extends MenuComponent {
    private String name;
    private String destription;
    private boolean vegetarian;
    private double price;

    public MenuItem(String name, String destription, boolean vegetarian, double price)
    {
        this.name = name;
        this.destription = destription;
        this.vegetarian = vegetarian;
        this.price = price;
    }



    @Override
    public String getName()
    {
        return name;
    }

    @Override
    public String getDestription()
    {
        return destription;
    }

    @Override
    public boolean isVegetarian()
    {
        return vegetarian;
    }

    @Override
    public double getPrice()
    {
        return price;
    }

    @Override
    public void print()
    {
        System.out.print("   "+getName());
        if (isVegetarian()){
            System.out.print("(v)");
        }
        System.out.print(","+getPrice());
        System.out.println("——"+getDestription());
    }
}
